#include <iostream>

#include <vector>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int t;
	int n;
	vector<vector <int>> v_a;
	vector<int> v_n;
	cin>>t;
	
	for(int i=0;i<t;i++){
		//TODO
	cin>>n;
	v_n.insert(v_n.end(),n);
		vector<int> vv;
	for(int j=0;j<v_n[i];j++){
		//TODO
		cin>> n;
	
		vv.insert(vv.end(),n);
		
			}
			v_a.insert(v_a.end(),vv);
	}
/*
	for(int i=0;i<(int)v_n.size();i++){
		
		//TODO
		for(int j=0;j<(int)v_a[i].size();j++){
			//TODO
			cout<< v_a[i][j]<<"	";
		}
		cout <<endl;
	}
*/	

	
	bool bzc = true;
for(vector<int> aa : v_a)
{
	int max = *(std::max_element(aa.begin(),aa.end()));
	bzc = true;
	for(int bb: aa){
		//TODO
		//cout <<bb <<"	";
		if( max%bb !=0){
			//TODO
			bzc = false;
			break;
		}
		
	}
		if(bzc)
						{
							cout<<"Yes"<<endl;
						}
						else
						cout<<"No"<<endl;
	//cout<<endl;
	//cout<< *(std::max_element(aa.begin(),aa.end()))<<endl;
	

}


/*
	for(int i = 0;i<(int)v_n.size();i++){
		bzc = true;
		for(int j=0;j<(int)(v_a[i].size()-1);j++){
			//TODO
			int lend = *(v_a[i].end()--);
			if(lend%v_a[i][j] != 0){
				bzc = false;
				break;
				//TODO
			}
			
		
		}
		
			if(bzc)
					{
						cout<<"Yes"<<endl;
					}
					else
					cout<<"No"<<endl;
		
		
		
		
	}
	
*/	
	
	return 0;
}
